﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace McMySkin_Installer
{
    public partial class LoginForm : NewForm
    {
        public NewMainForm parent;

        public LoginForm(NewMainForm parent)
        {
            this.parent = parent;
            InitializeComponent();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void pictureBox1_MouseEnter(object sender, EventArgs e)
        {
            pictureBox1.BackgroundImage = global::McMySkin_Installer.Properties.Resources.closeOnMouse;
        }

        private void pictureBox1_MouseLeave(object sender, EventArgs e)
        {
            pictureBox1.BackgroundImage = global::McMySkin_Installer.Properties.Resources.close;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(maskedTextBox1.Text))
            {
                MessageBox.Show("邮箱和密码不能为空 =w=", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                string returnString = new McMySkinLogin().DoLogin(textBox1.Text,maskedTextBox1.Text);
                if (LoginStatus.Login)
                {
                    parent.UpdateLoginStatus();
                    this.Close();
                }
                else
                {
                    label4.Text = returnString;
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}
